package com.thundersoft.musicplayer;


import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.thundersoft.musicplayer.adapter.MusicAdapter;
import com.thundersoft.musicplayer.base.BaseActivity;
import com.thundersoft.musicplayer.pojo.Music;
import com.thundersoft.musicplayer.utils.MusicUtils;

import java.util.List;

public class MainActivity extends BaseActivity {

    private RecyclerView recyclerView;
    private List<Music> musicList;
    private MusicAdapter adapter;
    private Context mContext;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext = this;
        setContentView(R.layout.activity_main);
        recyclerView = findViewById(R.id.recycler_view);
        musicList = MusicUtils.getMusicList(mContext);
        LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
        recyclerView.setLayoutManager(layoutManager);
        adapter = new MusicAdapter(mContext, musicList);
        recyclerView.setAdapter(adapter);
    }

    public void initMusic() {
        for (int i = 0; i < 10; i++) {
            Music music = new Music("哈哈", "黑Hier", "cd/sdk", "123456", 13);
            musicList.add(music);
        }
    }
}